OverlayCapableJsPlumbUIComponent

Base class for components that support Overlays. This class should never be directly instantiated.

new OverlayCapableJsPlumbUIComponent()

Source:
  • overlaycomponent.js, line 1

Extends

Members

overlays

List of Overlays for this component.

Source:
  • overlaycomponent.js, line 3

Methods

addClass(class)

Adds a class or some classes to the visual elements for the given component.

Parameters:
Name Type Description
class String

The class(es) to add. The values are appended as given, meaning you can supply a space separated string of several classes if you wish.

Inherited From:
Source:
  • uicomponent.js, line 11

addOverlay(overlaySpec)

Adds an Overlay to the component.

Parameters:
Name Type Description
overlaySpec Object

Specification of the Overlay to add.

Source:
  • overlaycomponent.js, line 29

addType(typeId, params, doNotRepaint)

Adds a type to the component. Note this is distinct from jsPlumbUIComponent#setType, which overrides all current types - this function just adds a type to the existing list.

Parameters:
Name Type Argument Default Description
typeId String

Id of the type to add.

params Object <optional>

Optional params to use when applying the type.

doNotRepaint Boolean <optional>
false

Tells jsPlumb not to repaint after adding the type.

Inherited From:
Source:
  • uicomponent.js, line 23

bind(event, listener)

Binds a listener to an event.

Parameters:
Name Type Description
event String

Name of the event to bind to.

listener Function

Function to execute.

Inherited From:
Source:
  • util-api.js, line 21

cleanupListeners()

Removes all listeners.

Inherited From:
Source:
  • util-api.js, line 28

getLabel()

Returns the label text for this component (or a function if you are labelling with a function). This does not return the overlay itself; this is a convenience method which is a pair with setLabel; together they allow you to add and access a Label Overlay without having to create the Overlay object itself. For access to the underlying label overlay that jsPlumb has created, use getLabelOverlay.

Source:
  • overlaycomponent.js, line 5
See:
  • #getOverlay
  • #getLabelOverlay

getLabelOverlay() → {Overlay}

Source:
  • overlaycomponent.js, line 7
See:
  • #setLabel
Returns:

The underlying internal label overlay, which will exist if you specified a label on a connect call, or have called setLabel at any stage. Otherwise it will be null.

Type
Overlay

getOverlay(overlayId) → {Overlay}

Gets an overlay, by ID. Note: by ID. You would pass an 'id' parameter in to the Overlay's constructor arguments, and then use that to retrieve it via this method.

Parameters:
Name Type Description
overlayId String

Id of the overlay to retrieve.

Source:
  • overlaycomponent.js, line 9
Returns:

The overlay stored against the given id, null if not found.

Type
Overlay

getOverlays() → {Array}

Gets all the overlays for this component.

Source:
  • overlaycomponent.js, line 11
Returns:

List of the component's overlays.

Type
Array

getParameter(name) → {Object}

Gets a parameter from the component

Parameters:
Name Type Description
name String

Name of the parameter to get

Inherited From:
Source:
  • uicomponent.js, line 3
Returns:

The given parameter's value, null if not found.

Type
Object

getParameters() → {Object}

Gets all parameters from the component. Note that you are given the actual parameters object, not a copy, so you can alter their values directly, and if you hold the reference to the parameters object you could cause a memory leak.

Inherited From:
Source:
  • uicomponent.js, line 7
Returns:

All of the component's parameters.

Type
Object

getType() → {String[]}

Gets the current type - or types - for this component.

Inherited From:
Source:
  • uicomponent.js, line 17
Returns:

The current list of types, empty if none registered.

Type
String[]

hasType(typeId) → {Boolean}

Returns whether or not the component currently has the given type.

Parameters:
Name Type Description
typeId String

Id of the type to check for

Inherited From:
Source:
  • uicomponent.js, line 21
Returns:

True if the component has the type, false if not.

Type
Boolean

hideOverlay(overlayId)

Hides the overlay specified by the given id.

Parameters:
Name Type Description
overlayId String

Id of the overlay to hide.

Source:
  • overlaycomponent.js, line 13

hideOverlays()

Hides all Overlays for this component.

Source:
  • overlaycomponent.js, line 15

isHover() → {Boolean}

Returns whether or not the object is currently in hover state

Inherited From:
Source:
  • uicomponent.js, line 29
Returns:

True if in hover state, false if not.

Type
Boolean

isSuspendEvents() → {Boolean}

Inherited From:
Source:
  • util-api.js, line 27
Returns:

True if events are suspended, false otherwise.

Type
Boolean

reapplyTypes(params)

Reapplies the current list of types with the given (optional) parameters. See the jsPlumb documentation for a full discussion of types.

Parameters:
Name Type Argument Description
params Object <optional>

Optional params to use when reapplying types.

Inherited From:
Source:
  • uicomponent.js, line 19

removeAllOverlays()

Removes all overlays from the component, and then repaints.

Source:
  • overlaycomponent.js, line 21

removeClass(class)

Removes a class or some classes from the visual elements for the given component. You can supply a space separated string of several classes if you wish.

Parameters:
Name Type Description
class String

The class(es) to remove.

Inherited From:
Source:
  • uicomponent.js, line 13

removeOverlay(overlayId)

Removes an overlay by ID. Note: by ID. this is a string you set in the overlay spec.

Parameters:
Name Type Description
overlayId String

Id of the overlay to remove.

Source:
  • overlaycomponent.js, line 23

removeOverlays(overlayIds)

Removes a set of overlays by ID. Note: by ID. This is a string you set in the overlay spec.

Parameters:
Name Type Argument Description
overlayIds String <repeatable>

This function takes an arbitrary number of arguments, each of which is a single overlay id.

Source:
  • overlaycomponent.js, line 25

removeType(typeId, doNotRepaint)

Removes the given type from the component.

Parameters:
Name Type Argument Default Description
typeId String

Id of the type to remove.

doNotRepaint Boolean <optional>
false

Tells jsPlumb not to repaint after removing the type.

Inherited From:
Source:
  • uicomponent.js, line 25

setHover(hover, ignoreAttachedElements)

Sets/unsets the hover state of this component.

Parameters:
Name Type Argument Default Description
hover Boolean

Hover state boolean

ignoreAttachedElements Boolean <optional>
false

If true, does not notify any attached elements of the change in hover state. Used mostly by jsPlumb internally, to avoid infinite loops.

Inherited From:
Source:
  • uicomponent.js, line 33

setHoverPaintStyle(style, doNotRepaint)

Sets the paint style to use when the mouse is hovering over the component. This is null by default. The hover paint style is applied as extensions to the paintStyle; it does not entirely replace it. This is because people will most likely want to change just one thing when hovering, say the color for example, but leave the rest of the appearance the same.

Parameters:
Name Type Argument Description
style Object

Style to use when the mouse is hovering.

doNotRepaint Boolean <optional>

If true, the component will not be repainted. Useful when setting things up initially.

Inherited From:
Source:
  • uicomponent.js, line 31

setLabel(label)

Sets the component's label.

Parameters:
Name Type Description
label String | Function | Object

Label to set. May be a String, a Function that returns a String, or a params object containing { "label", "labelStyle", "location", "cssClass" }. Note that this uses innerHTML on the label div, so keep that in mind if you need escaped HTML.

Source:
  • overlaycomponent.js, line 27

setPaintStyle(style, doNotRepaint)

Sets the component's paint style and then repaints the component.

Parameters:
Name Type Argument Default Description
style Object

Style to use.

doNotRepaint Boolean <optional>
false

If true, the component will not be repainted.

Inherited From:
Source:
  • uicomponent.js, line 35

setParameter(name, value)

Sets a parameter on the component

Parameters:
Name Type Description
name String

Name of the parameter to set

value Object

Value to set

Inherited From:
Source:
  • uicomponent.js, line 5

setParameters(params)

Sets all parameters on the component.

Parameters:
Name Type Description
params Object

Parameters to set.

Inherited From:
Source:
  • uicomponent.js, line 9

setType(typeId, params, doNotRepaint)

This function sets a type for the given component. It replaces all existing types. For a full discussion of the concept of types, see the jsPlumb documentation.

Parameters:
Name Type Argument Default Description
typeId String

Id of the type to set.

params Object <optional>

Optional parameter object to expand.

doNotRepaint Boolean <optional>
false

Tells jsPlumb not to repaint after setting the type.

Inherited From:
Source:
  • uicomponent.js, line 15

showOverlay(overlayId)

Shows the overlay specified by the given id.

Parameters:
Name Type Description
overlayId String

Id of the overlay to show.

Source:
  • overlaycomponent.js, line 18

showOverlays()

Shows all Overlays for this component.

Source:
  • overlaycomponent.js, line 20

suspendEvents(val)

Sets whether or not events are suspended.

Parameters:
Name Type Description
val Boolean

Whether or not to suspend events.

Inherited From:
Source:
  • util-api.js, line 26

toggleType(typeId, params, doNotRepaint)

Toggles the given type on the component.

Parameters:
Name Type Argument Default Description
typeId String

Id of the type to toggle.

params Object <optional>

Optional params to use if the type does not exist and jsPlumb applies it.

doNotRepaint Boolean <optional>
false

Tells jsPlumb not to repaint after toggling the type.

Inherited From:
Source:
  • uicomponent.js, line 27

unbind(event)

Clears either all listeners, or listeners for some specific event.

Parameters:
Name Type Argument Description
event String <optional>

Optional. constrains the clear to just listeners for this event.

Inherited From:
Source:
  • util-api.js, line 25